package sandau.self_improvement_wall.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import sandau.self_improvement_wall.security.JWTInterceptor;

@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    // 注入 IpRateLimitInterceptor
    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(jwtInterceptor())
                .excludePathPatterns("/api/login")
                .addPathPatterns("/api/**");
    }
    @Bean
    public JWTInterceptor jwtInterceptor() {
        return new JWTInterceptor();
    }

}


